#include"progress.h"

//函数指针
typedef void(*callback_t)(double total, double current);

double total = 1024.0;
double speed = 1.0;//每秒下载速度

void DownLoad(callback_t cb)
{
    double current = 0;
    while(current <= total)
    {
        cb(total, current);
        //下载代码
        usleep(3000);//暂停执行一段时间的程序
        current += speed;
    }
    printf("\nDownLload %.2lfMB Done\n", current);
}

int main()
{
    DownLoad(FlushProgress);

    return 0;
}
